package com.zrh.jsd.common;

import sun.misc.BASE64Encoder;

import java.io.FileInputStream;
import java.security.KeyStore;
import java.security.PrivateKey;

public class Test {
    public static void main(String[] args) {
        try {
            BASE64Encoder encoder = new BASE64Encoder();
            //读取文件内容
            FileInputStream is = new FileInputStream("E:/keystore/uat.keystore");
            KeyStore ks = KeyStore.getInstance("JKS");
            ks.load(is, "password".toCharArray());
            PrivateKey key = (PrivateKey) ks.getKey("uat", "password".toCharArray());
            String encoded = encoder.encode(key.getEncoded());
            System.out.println(encoded);
            is.close();
        } catch (Exception e){
        }

    }
}
